package com.example.cmh.mapper;

import com.example.cmh.pojo.Course;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CourseMapper {
    int insert(Course course);
    int deleteById(Integer courseId);
    int updateById(Course course);
    List<Course> selectByCondition(@Param("courseName") String courseName,
                                  @Param("courseSort") Integer courseSort);
    Course selectById(Integer courseId);
    
    // 分页查询课程列表
    List<Course> selectWithPage(@Param("courseName") String courseName,
                               @Param("courseSort") Integer courseSort,
                               @Param("courseStatus") Integer courseStatus,
                               @Param("createPersonId") Integer createPersonId,
                               @Param("offset") int offset,
                               @Param("limit") int limit);
    
    // 统计符合条件的课程总数
    long count(@Param("courseName") String courseName,
               @Param("courseSort") Integer courseSort,
               @Param("courseStatus") Integer courseStatus,
               @Param("createPersonId") Integer createPersonId);
    
    // 更新课程审核状态
    int updateStatus(@Param("courseId") Integer courseId, @Param("status") Integer status);
} 